<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
    <meta charset="utf-8">
    <title>教务在线系统</title>
    <!-- 引入LayUI在线样式 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui@2.8.3/dist/css/layui.min.css">
    <style>
        body {
            background-color: #f2f2f2;
        }
        .layui-layout-admin .layui-header {
            background-color: #1E9FFF;
        }
        .layui-layout-admin .layui-logo {
            color: white;
            font-weight: bold;
        }
        .layui-side {
            background-color: #39435c;
        }
        .layui-nav-tree {
            background-color: #39435c;
        }
        .layui-nav-tree .layui-nav-child dd.layui-this,
        .layui-nav-tree .layui-nav-child dd.layui-this a,
        .layui-nav-tree .layui-this,
        .layui-nav-tree .layui-this a {
            background-color: #1E9FFF;
        }
        .layui-nav-tree .layui-nav-item > a:hover {
            background-color: #2a334b;
        }
        .content-card {
            margin: 15px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .welcome-container {
            text-align: center;
            padding: 50px 20px;
        }
        .welcome-title {
            font-size: 24px;
            color: #1E9FFF;
            margin-bottom: 20px;
        }
        .welcome-content {
            font-size: 16px;
            color: #666;
            line-height: 1.8;
        }
        .footer {
            text-align: center;
            color: #999;
        }
        .stat-card {
            text-align: center;
            padding: 20px;
        }
        .stat-number {
            font-size: 32px;
            font-weight: bold;
            color: #1E9FFF;
            margin: 10px 0;
        }
        .stat-title {
            font-size: 16px;
            color: #666;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!-- 顶部导航栏 -->
    <div class="layui-header">
        <div class="layui-logo">教务在线系统</div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="javascript:;">首页</a></li>
            <li class="layui-nav-item"><a href="javascript:;">教学管理</a></li>
            <li class="layui-nav-item"><a href="javascript:;">学生工作</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">系统管理</a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;">用户管理</a></dd>
                    <dd><a href="javascript:;">权限设置</a></dd>
                    <dd><a href="javascript:;">系统日志</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="https://picsum.photos/id/1005/40/40" class="layui-nav-img" alt="头像">
                    管理员
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:">个人设置</a></dd>
                    <dd><a data-url="common/update_password" href="javascript:">修改密码</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="/logout">退出</a></li>
        </ul>
    </div>

    <!-- 左侧菜单 -->
    <div class="layui-side">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" id="menu" lay-filter="sideMenu">

            </ul>
        </div>
    </div>

    <!-- 内容区域 -->
    <div class="layui-body" id="contentContainer">

    </div>

    <!-- 底部页脚 -->
    <div class="layui-footer">
        <div class="footer">
            © 2023 教务在线系统 | 技术支持：信息中心 | 版本号：v2.1.0
        </div>
    </div>
</div>

<!-- 引入LayUI的JS -->
<script src="https://cdn.jsdelivr.net/npm/layui@2.8.3/dist/layui.js"></script>
<script>
    layui.use(['element', 'layer'], function(){
        var element = layui.element;
        var layer = layui.layer;
        var $ = layui.jquery;

        // 模拟加载
        var index = layer.load(1, {
            shade: [0.1,'#fff'] //0.1透明度的白色背景
        });

        // 初始化左侧菜单
        $.ajax({
            url: "/queryCurUserPermission",
            type: "get",
            dataType: "json",
            success: function (resp) {
                var data = resp.data;
                var html = "";
                for (var i = 0; i < data.length; i++) {
                    html += '<li class="layui-nav-item">';
                    html += '<a href="javascript:;">' + data[i].permName + '</a>';
                    html += '<dl class="layui-nav-child">';
                    for (var j = 0; j < data[i].children.length; j++) {
                        html += '<dd><a data-url="'+data[i].children[j].url+'" href="javascript:;">' + data[i].children[j].permName + '</a></dd>';
                    }
                    html += '</dl>';
                    html += '</li>';
                }

                $("#menu").html(html);
                element.render('nav', 'sideMenu');
            }
        })



        // 加载首页内容
        $("#contentContainer").load("welcome.jsp", function (response, status, xhr) {

        });

        $("#menu").on('click','a',function () {
            var url = $(this).data("url");
            if (url != null) {
                $("#contentContainer").load(url, function (response, status, xhr) {

                });
            }
        });

        // 关闭加载层
        setTimeout(function(){
            layer.close(index);
        }, 500);
    });
</script>
</body>
</html>